Improving the inbuilt commands

back to section start!

  One thing that may not become immediately obvious is the fact that all the
internal Opus commands can be replaced by your own versions of them.

  You can do this by writing your own module.  Using the Opus SDK, (Software
Developers Kit), you can write it in a language such as 'C', 'E', Assembler,
or BASIC.  You can also do it by using ARexx.

  It is just the same as writing any normal ARexx module, you just specify
your command name to be the same as one of the Opus internal ones.

  Naming your commands the same as Opus ones, causes them to override the
internal commands.

  For example, you could improve the operation of the Copy command so that
when it tried to copy over a file with the same name, it could prompt you
with the option to rename the file, (instead of just the normal options of
Skip and Replace), then proceed with the copy as normal.

  The example below was initially a script in the DOpus5:ARexx/ directory,
written by Sylvain Bourcier, <booze@videotron.ca>, I rewrote it so that it
was a module replacing the internal versions of the Root and Parent command
with slightly more functional ones.

  If you want to use this module on your computer, simply click on this
 button  and it will be copied to your DOpus5:Modules/ directory.

  Since it replaces existing Opus commands, there's no need to make any
special buttons.  The next time you use Root or Parent in the root directory
of a device, you will be presented with the device list.

/*
$VER: RootParent.dopus5 1.2 (12.8.98)
Replaces internal Root and Parent commands with versions that will display
the Device List if in the root of a device.

USAGE: Copy it to DOpus5:Modules/ It will replace the existing
       Root and Parent command functions.
 */
options results
parse arg port func srce dest args .
address value port

if func = 'init' then do
  dopus command "Root" program "RootParent" desc "Root/Devices" template "UNSELECT/S"
  dopus command "Parent" program "RootParent" desc "Parent/Devices" template "UNSELECT/S"
  exit
end

lister query srce path
path = result
if upper(args) = 'UNSELECT' then command source srce wait none
if right(path,1) = ':' then command source srce wait devicelist full
    else command source srce original func
exit


  Here's another simple one for those people still using the Trashcan.  An
internal DeleteTC command will be added, using this instead of Delete will
cause the selected entries to be moved to SYS:Trashcan/.
  And we also add an EmptyTC command which you can put into the User Menus
as 'Empty Trashcan', just like the good ol' days ;-)

/*
$VER: Delete.dopus5 1.0 (8.9.98)
When you hit Delete, will copy of selected entries to the Trashcan before
deleting them.
*/
options results
parse arg port func srce dest args .
address value port

if func = 'init' then do
  dopus command "DeleteTC" program "Delete" desc "Move selected to Trashcan"
  dopus command "EmptyTC" program "Delete" desc "Empty the trash"
  exit
  end

if func = 'DeleteTC' then command source srce original move 'TO SYS:Trashcan'
if func = 'EmptyTC' then command original delete 'SYS:Trashcan/#? QUIET'
exit

DOpus PLUS - giving you that bit extra...